<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Cms Category Management</title>
<?php $this->view('regions/head'); ?>
</head>
<body>
<div id="wrapper" class="block">
	<?php $this->view('regions/header'); ?>
	<div id="content" class="block">
		<?php echo form_open_multipart('admin/cms/category/save'); ?>
        <?php echo fx_control::newInstance('formKey')->createType('hidden')->setData('value', random_string('unique', 16))->render(); ?>
		<?php echo fx_control::newInstance('category_id')->createType('hidden')->binding($model, 'id')->render(); ?>
		<div class="stdWidth autoCenter autoHeight">
			<div id="mainLeft" class="block left column25">
				<h3>Category</h3>
				<div class="buttonSet">
					<button type="button" onclick="window.location='<?php echo $model->getIndexUrl(); ?>'">Add Root Category</button>
					<button type="button" onclick="window.location='<?php echo $model->getIndexUrl('parent/'.$model->getId()); ?>'">Add Child Category</button>
				</div>
				<div class="block clear paddingTop15">
					<ul id="tree">
						<?php if ($model->isLoaded()) :?>
							<?php echo $model->genTree(0, $model->getId()); ?>
						<?php else :?>
							<?php echo $model->genTree(0); ?>
						<?php endif; ?>
					</ul>
				</div>
			</div>
			<div id="mainRight" class="block right autoHeight column75">
				<div class="formHeader clear borderBottom">
					<table>
						<tr>
							<td style="width: 400px"><h3>New Category</h3></td>
							<td align="right">
								<div class="buttonSet right">
									<?php echo fx_control::newInstance('submit')->createType('submit')->setData('value', 'Save Category')->render(); ?>
									<?php echo fx_control::newInstance('reset')->createType('reset')->setData('value', 'Reset')->render(); ?>
								</div>
							</td>
						</tr>
					</table>
				</div>
                <div id="tabCategory" class="tabContainer border">
                        <ul>
                            <li><a href="#general"><span>General Data</span></a></li>
                            <li><a href="#meta"><span>Meta Data</span></a></li>
                            <li><a href="#manga"><span>Manga</span></a></li>
                        </ul>
                        <div id="general" class="frameBlock clear">
							<?php $this->view('cms/category/edit/form'); ?>
						</div>
                        <div id="meta" class="frameBlock clear">
                        	<?php $this->view('cms/category/edit/meta'); ?>  
                        </div>
                        <div id="manga">
                            <?php $this->view('cms/category/edit/manga'); ?>
                        </div>
				</div>
			</div>
		</div>
		<?php echo form_close(); ?>
	</div>
	<?php $this->view('regions/footer'); ?>
	<!-- Init Tabs -->
	<script type="text/javascript">
	jQuery(function() {
		jQuery('#tabCategory').tabs({});
	});
	</script>
</div>
</body>
</html>
